-- background: 2648 from stack: in -- bmap block id: 3292 -- flags: 0000 -- background id: 0 -- name: Six Monthly ----- HyperTalk script ----- on closeCard hide bkgnd button "Bracket" end closeCard on mouseUp --give a date in the week that was clicked on, (a month field) if the name of the target contains "name" or the name of the target contains "year" then exit mouseUp put the short name of the target & "name" into label put (item 2 of the clickLoc) - (item 2 of the rect of the target) into myDay put (myDay DIV textHeight of the target) +1 into myDay put word myDay of "1 8 15 22 29 36" into myDay put field label && myDay & "," && field "year" into myDate convert myDate to dateItems if item 7 of myDate = 1 then add 1 to item 3 of myDate --if using a Sunday, move into the next week goWeekly myDate end mouseUp on bracketWeek myDate --assume we are on the right card convert myDate to dateItems put item 2 of myDate into it if it > 6 then subtract 6 from it put "cal" & it into myField put ((item 3 of myDate) + 6 - (item 7 of myDate)) DIV 7 into it put loc of field myfield into newLoc put item 2 of rect of field myField into item 2 of newLoc add (it * the textHeight of field myField) + 7 to item 2 of newLoc show bkgnd button "bracket" at newLoc end bracketWeek on extendHalfYearly if the number of backgrounds > 1 then go to last card of bkgnd "weekly" get field "month" put word 2 of it && "1," && word 1 of it into endDate else put the seconds + (60*60*24*31) into endDate convert endDate to seconds go to last card of bkgnd "six monthly" put field cal6Name && "1," && field "year" into nowDate convert nowDate to seconds add 60*60*24*32 to nowDate --start of next 6 month period repeat until nowDate >= endDate doMenu "New Card" fillHalfYear nowDate add 60*60*24*183 to nowDate end repeat put the number of this card into it --last sixMonth card if (the number of backgrounds > 1) and (it > 5) then go to first card of bkgnd "Six Monthly" if the number of this card = 1 then repeat for it-5 --only allow 5 cards at the front doMenu "delete card" end repeat end if end if end extendHalfYearly on fillHalfYear startDate convert startDate to dateItems if item 2 of startDate is not in "1 7" then exit fillHalfYear put item 1 of startDate into field Year convert startDate to seconds repeat with ff = 1 to 6 put startDate into it convert it to long date put word 1 of item 2 of it into field ("cal" & ff & "name") put " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 " & "18 19 20 21 22 23 24 25 26 27 28" into field ("cal" & ff) convert it to dateItems put 1 into item 3 of it convert it to long date convert it to dateItems repeat (item 7 of it)-1 put " " before field ("cal" & ff) end repeat repeat with dd = 29 to 31 put dd into item 3 of it convert it to long date convert it to dateItems if item 3 of it = dd then put space & dd after field ("cal" & ff) else exit repeat end repeat put return after character 42 of field ("cal" & ff) put return after character 21 of field ("cal" & ff) add 60*60*24*31 to startDate end repeat end fillHalfYear on newStack put the seconds into myDate convert myDate to dateitems if item 2 of myDate > 6 then put 7 into item 2 of myDate else put 1 into item 2 of myDate fillHalfYear myDate end newStack -- part 57 (button) -- low flags: 80 -- high flags: 0002 -- rect: left=281 top=246 right=259 bottom=409 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Bracket ----- HyperTalk script ----- on mouseUp --should be behind all fields, but just in case hide bkgnd button "bracket" click at the loc of bkgnd button "bracket" end mouseUp